/*
 ------------------------------------------------------------------------------
 Copyright (C) 1996-2001 Id Software, Inc.

 This file is part of the Quake source code.

 The Quake source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quake source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quake source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// defManager.h - definition manager
//


#ifndef __DEFMANAGER_H__
#define __DEFMANAGER_H__


/*
 ==============================================================================

 Definition Manager:

 A definition is a text data type that defines the properties and behaviour of
 certain aspects of the game, such as surface materials or sound effects.

 All "small text" data types, like tables, skins, materials, sound shaders,
 etc, are managed uniformly, allowing reloading, purging, enumerating, listing,
 printing, etc.
 All "large text" data types that never have more than one definition in a
 given file, like maps, GUIs, etc, are not handled here.

 During definition parsing, errors should never be issued, only warnings. A
 default definition should always be used in place of a bad definition.

 ==============================================================================
*/

// Registers a definition type
void			Def_RegisterType (defType_t type, const char *typeName, const char *filePath, const char *fileExtension, const char *listCommand, const char *printCommand);

// Loads all the definitions of the given type
void			Def_LoadDefs (defType_t type, bool print);

// Purges all the definitions of the given type
void			Def_PurgeDefs (defType_t type);

// Enumerates all the definitions of the given type using a callback
void			Def_EnumDefs (defType_t type, void (*callback)(const char *name));

// Returns the number of definitions of the given type
int				Def_GetNumDefs (defType_t type);

// Returns a definition of the given type with the given index. Returns NULL if
// the index is out of range.
defData_t *		Def_GetDefByIndex (defType_t type, int index);

// Finds a definition of the given type with the given name. Returns NULL if
// not found.
defData_t *		Def_FindDef (defType_t type, const char *name);

// Initializes the definition manager
void			Def_Init ();

// Shuts down the definition manager
void			Def_Shutdown ();


#endif	// __DEFMANAGER_H__